using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Geoconcepts.SocialServices;

namespace Geoconcepts.SocialServices.WebTest
{
    public partial class _Default : System.Web.UI.Page
    {

        protected void btnGetAlternateNames_Click(object sender, EventArgs e)
        {
            Geonames svcGeonames = new Geonames();

            try
            {
                if (txtCity.Text != "" && txtCountryCode.Text != "")
                {
                    txtResult.Text = svcGeonames.GeonamesGetAlternateNames(txtCity.Text, txtCountryCode.Text);
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }

        protected void btnGetAllAlternateNames_Click(object sender, EventArgs e)
        {
            Geonames svcGeonames = new Geonames();

            try
            {
                if (txtCity.Text != "" && txtCountryCode.Text != "")
                {
                    txtResult.Text = svcGeonames.GeonamesGetAllAdministrativeAlternateNames(txtCity.Text, txtCountryCode.Text);
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }

        protected void btnGetPhotos_Click(object sender, EventArgs e)
        {
            GeoResource dtsGeoResource = new GeoResource();

            try
            {
                GeoReferencedData svcGeoData = new GeoReferencedData();

                //dtsGeoResource = svcGeoData.GetFlickrGeoResources();
                dtsGeoResource = svcGeoData.GetPanoramioGeoResources(-2.02, -1.96, 43.29, 43.331);
                dgvPhotos.DataSource = dtsGeoResource;
                dgvPhotos.DataBind();

                
            }
            catch (Exception ex)
            {
                throw (ex);
            }


        }

        protected void btnGenerateParameters_Click(object sender, EventArgs e)
        {
            GeoSource dtsGeoSource = new GeoSource();

            dtsGeoSource.GeoSources.AddGeoSourcesRow("flickr", "3c13ca16213bb08925a794bf92678931", 0, 0, 0, 0,new DateTime(1970,1,1),"","");
            dtsGeoSource.GeoSources.AddGeoSourcesRow("panoramio", "", 0, 0, 0, 0, new DateTime(1970, 1, 1), "", "");
            dtsGeoSource.AcceptChanges();
            dtsGeoSource.WriteXml("C:\\SemWeb\\GeoSource.xml");

        }
    }
}
